<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h1>ajax入门案例</h1>
		<script type="text/javascript" src="../js/axios.js"></script>
		
		<script type="text/javascript">
			axios.defaults.baseURL = "htt://localhost:8080"
			
			let url1 = "http://localhost:8080/axios/findStr"
			axios.get("/axios/findStr1")
			.then(function(promise){
				console.log(promise)
				console.log(promise.data)
			})
			
			let url2 = "http://localhost:8080/axios/getUserById1?id=100"
			axios.get("/axios/getUserById1?id=100")
			.then(function(promise){
				console.log(promise.data)
			})
			
			let user = {
				id : 100,
				name : "tomcat"
			}
			axios.get("/axios/findUser1",{params : user})
			.then(promise => {
				console.log(promise.data)
				})
			
			let rest1 = {
				id : 100,
				name : "tomcat",
				age : 18
			}
			axios.get("/axios/result1/"+rest1.id+"/"+rest1.name +"/"+rest1.age)
			.then(promie => {
				console.log(promise.data)
			})
			
			let rest2 = {
				id : 100,
				name : "tomcat",
				age : 18
			}
			axios.get(`/axios/result1/${rest2.id}/${rest2.name}/${rest2.age}`)
			.then(promise => {
				console.log(promise.data)
			})
			//模板字符串,保证代码的格式
			let div = `<div>
							<p>天青色等烟雨</p>
							<p>而我在等你</p>
					        <p>炊烟渺渺升起</p>
							<p>隔江千万里</p>
					  </div>`
		</script>
	</body>
</html>
